﻿using AutoMapper;
using MediatR;
using S.PurchaseAndSales.Api.Application.Command.PurchaseFormCommand;
using S.PurchaseAndSales.Infrastructure.Interface.PurchaseForm;

namespace S.PurchaseAndSales.Api.Application.CommandHandlers.PurchaseFormHandler
{
    /// <summary>
    /// 删除供应商
    /// </summary>
    public class VendorDeleteCommandHandler : IRequestHandler<VendorDeleteCommand, bool>
    {
        private readonly IVendorRepository repository;

        public VendorDeleteCommandHandler(IVendorRepository repository)
        {
            this.repository = repository;
        }
        public async Task<bool> Handle(VendorDeleteCommand request, CancellationToken cancellationToken)
        {
            return await repository.DeleteAsync(request.VendorSnowId);
        }
    }
}
